import { Controller } from "../../mvc/core/Controller";
import { ClockManager } from "../manager/ClockManager";
import { TimeEvent } from "../events/TimeEvent";
import { Game } from "../Game";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { CopyConfig } from "../resource/CopyConfig";
import { ECopyType } from "../../../Message/Public/ECopyType";
import { DataEvent } from "../events/DataEvent";
import { EDifficultyOption } from "../../../Message/Public/EDifficultyOption";
import { AutoKickOutManager } from "../view/copy/AutoKickOutManager";
import { NetDispatcher } from "../../mvc/core/NetDispatcher";
import { ServerCommand } from "../mvc/ServerCommand";
import { TCopy } from "../../../Message/Db/Tables/TCopy";
import { MsgManager } from "../manager/MsgManager";
import { GameMapUtil } from "../scene/map/GameMapUtil";
import { ObjCreate } from "../view/common/ObjCreate";
import { ResFileConst } from "../resource/ResFileConst";
import { LayerManager } from "../manager/LayerManager";
import { EffectManager } from "../manager/EffectManager";
import { FilterConst } from "../../component/gconst/FilterConst";
import { CopyCodeRule } from "../rules/CopyCodeRule";
import { CopyDrawRewardButton } from "../view/copy/drawRewards/CopyDrawRewardButton";
import { ItemData } from "../resource/info/ItemData";
import { ThingUtil } from "../scene/layer/utils/ThingUtil";
import { SCopyMsgInfo } from "../../../Message/Public/SCopyMsgInfo";
import { ECopyInfoType } from "../../../Message/Public/ECopyInfoType";
import { CopyRewardsAccountPanel } from "../view/copy/popupBox/CopyRewardsAccountPanel";
import { PopupManager } from "../manager/PopupManager";
import { PulseSharedObject } from "../view/player/PulseSharedObject";
import { TodayNoTipsConst } from "../../component/gconst/TodayNoTipsConst";
import { CopyGradeAccountView } from "../view/copy/copyGrade/CopyGradeAccountView";
import { ViewEvent } from "../../mvc/events/ViewEvent";
import { Language } from "../../../extend/language/Language";
import { CopyUtil } from "../view/copy/CopyUtil";
import { GameProxy } from "../mvc/GameProxy";
import { ECopyWaitingOperate } from "../../../Message/Public/ECopyWaitingOperate";
import { TaskActInfo } from "../resource/info/TaskActInfo";
import { Alert } from "../../../com/mui/controls/Alert";
import { AIManager } from "../scene/ai/AIManager";
import { Global } from "../../../com/gengine/global/Global";
import { HTMLUtil } from "../../../com/gengine/utils/HTMLUtil";
import { GameConst } from "../../component/gconst/GameConst";
import { CopyDrawRewardPanel } from "../view/copy/drawRewards/CopyDrawRewardPanel";
import { CopyDrawRewardComp } from "../view/copy/drawRewards/CopyDrawRewardComp";
import { EPassType } from "../../../Message/Game/EPassType";
import { GameDefConfig } from "../resource/GameDefConfig";
import { EPrictUnit } from "../../../Message/Public/EPrictUnit";
import { AutoFight } from "../view/autoFight/AutoFight";
import { BuyAlert } from "../view/pet/BuyAlert";
import { MagicTowerConfig } from "../resource/MagicTowerConfig";
import { SEntityId } from "../../../Message/Public/SEntityId";
import { CopyGroupController } from "../view/copy/controller/CopyGroupController";
import { CopyFairyController } from "../view/copy/controller/CopyFairyController";
import { DefenceCopyController } from "../view/copy/controller/DefenceCopyController";
import { SixtyCopyController } from "../view/copy/controller/SixtyCopyController";
import { GuildCopyController } from "../view/copy/controller/GuildCopyController";
import { GuildCopyDefenseController } from "../view/copy/controller/GuildCopyDefenseController";
import { GuildEliteCopyController } from "../view/copy/controller/GuildEliteCopyController";
import { TowerCopyController } from "../view/copy/controller/TowerCopyController";
import { SeventyCopyController } from "../view/copy/controller/SeventyCopyController";
import { EightyCopyController } from "../view/copy/controller/EightyCopyController";
import { LevelSealController } from "../view/copy/controller/LevelSealController";
import { CrossStairController } from "../view/copy/controller/CrossStairController";
import { CrossDefenceCopyController } from "../view/copy/controller/CrossDefenceCopyController";
import { CrossAryadevaSecretCopyController } from "../view/copy/controller/CrossAryadevaSecretCopyController";
import { GuildRobCityCopyController } from "../view/copy/controller/GuildRobCityCopyController";
import { KingCopyController } from "../view/copy/controller/KingCopyController";
import { EatBeansController } from "../view/copy/controller/EatBeansController";
import { KingChampionShipController } from "../view/copy/controller/KingChampionShipController";
import { CrossSeaController } from "../view/copy/controller/CrossSeaController";
import { CountryMoneyCopyController } from "../view/copy/controller/CountryMoneyCopyController";
import { RobFlagController } from "../view/copy/controller/RobFlagController";
import { EightyDefenceCopyController } from "./EightyDefenceCopyController";
import { Lv88CopyController } from "../view/copy/controller/Lv88CopyController";
import { UpgradeCrossSecretCopyController } from "./UpgradeCrossSecretCopyController";
import { CopyMountController } from "../view/copy/controller/CopyMountController";
import { FaneCopyController } from "../view/copy/controller/FaneCopyController";
import { CrossTowerCopyController } from "../view/copy/controller/CrossTowerCopyController";
import { PloughCopyController } from "../view/copy/controller/PloughCopyController";
import { DominionWarCopyController } from "../view/copy/controller/DominionWarCopyController";
import { MaterialCopyController } from "../view/copy/controller/MaterialCopyController";
import { HeroBattleController } from "./HeroBattleController";
import { GuideTips } from "../view/guide/GuideTips";
import { GuideTipsManager } from "../manager/GuideTipsManager";
import { ModuleType } from "../view/common/ModuleType";
import { CopyType } from "../view/copy/CopyType";
import { EatBeansDoingStatus } from "../view/copy/eatBeans/EatBeansDoingStatus";
import { EEntityFightMode } from "../../../Message/Public/EEntityFightMode";
import { GAlertWin } from "../../../com/mui/controls/GAlertWin";
import { SceneConfig } from "../resource/SceneConfig";
import { MapFileUtil } from "../scene/map/MapFileUtil";
import { GlobalStyle } from "../../common/global/GlobalStyle";
import { ICopyController } from "../view/copy/controller/ICopyController";
import { GLoadedButton } from "../../../com/mui/controls/GLoadedButton";
import { Daily } from "../../../ModuleType/Daily";
type int = number;
//class CopyController
    
    export  class CopyController extends Controller
    {
        constructor()
        {
            
            super();this._copyMarkDic = new Map<any, any> /* flash.utils.Dictionary */();
            this.initControllers();
            ClockManager.instance.addEventListener(TimeEvent.DateChange, this.onCleanCopyEnteredNum);
            return;
        }

        /* internal  */onEnterCopy(arg1: Object): void
        {
            if (!Game.isSceneInit()) 
            {
                this._tempObj = arg1;
                Dispatcher.addEventListener(EventName.Scene_Update, this.onSceneUpdateHandler);
                return;
            }
            if (!cache.copy.isInCopy) 
            {
                return;
            }
            var loc1=CopyConfig.instance.getInfoByCode(arg1 as int);
            if (!loc1) 
            {
                return;
            }
            this.copyGroupController.hideGroupModules();
            var loc2=loc1.copyType;
            switch (loc2) 
            {
                case ECopyType._ECopyNormal:
                {
                    if (loc1.code == 123) 
                    {
                        this.currentCopy = this.fairyLandCopy;
                    }
                    break;
                }
                case ECopyType._ECopyDefense: case ECopyType._ECopy60Defense:
                {
                    this.currentCopy = this.defenceCopy;
                    break;
                }
                case ECopyType._ECopySixty:
                {
                    this.currentCopy = this.sixtyCopy;
                    break;
                }
                case ECopyType._ECopyTower:
                {
                    this.currentCopy = this.towerCopy;
                    break;
                }
                case ECopyType._ECopyGuildStruggle:
                {
                    this.currentCopy = this.guildCopy;
                    break;
                }
                case ECopyType._ECopyGuildDefense:
                {
                    this.currentCopy = this.guildCopyDefense;
                    break;
                }
                case ECopyType._ECopyGuildElite:
                {
                    this.currentCopy = this.guildEliteCopy;
                    break;
                }
                case ECopyType._ECopySeventy:
                {
                    this.currentCopy = this.seventyCopy;
                    break;
                }
                case ECopyType._ECopyEighty:
                {
                    this.currentCopy = this.eightyCopy;
                    break;
                }
                case ECopyType._ECopySeal:
                {
                    this.currentCopy = this.levelSealCopy;
                    break;
                }
                case ECopyType._ECopyCrossStair:
                {
                    this.currentCopy = this.crossStairCopy;
                    break;
                }
                case ECopyType._ECopyCrossBoss: case ECopyType._ECopyUpgradeCrossBoss:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.CopyEnterCrossBossCopy));
                    break;
                }
                case ECopyType._ECopyCrossDefense:
                {
                    this.currentCopy = this.crossDefenceCopy;
                    break;
                }
                case ECopyType._ECopyCrossSecret:
                {
                    this.currentCopy = this.crossAryadevaSecretCopy;
                    break;
                }
                case ECopyType._ECopyRobCityOne: case ECopyType._ECopyRobCityTwo: case ECopyType._ECopyRobCityThree:
                {
                    this.currentCopy = this.guildRobCityCopy;
                    break;
                }
                case ECopyType._ECopyEatBeans:
                {
                    this.currentCopy = this.eatBeans;
                    break;
                }
                case ECopyType._ECopyKingChampionship:
                {
                    this.currentCopy = this.kingChampionShip;
                    break;
                }
                case ECopyType._ECopyCrossSea:
                {
                    this.currentCopy = this.crossSea;
                    break;
                }
                case ECopyType._ECopyCountryMoney:
                {
                    this.currentCopy = this.countryMoneyCopy;
                    break;
                }
                case ECopyType._ECopyRobFlag:
                {
                    this.currentCopy = this.robFlag;
                    break;
                }
                case ECopyType._ECopy80Defense:
                {
                    this.currentCopy = this.eightyDefenceCopy;
                    break;
                }
                case ECopyType._ECopyFireMonsterIsland:
                {
                    this.currentCopy = this.lv88;
                    break;
                }
                case ECopyType._ECopyFireIslandCenter:
                {
                    this.currentCopy = this.lv88;
                    break;
                }
                case ECopyType._ECopyUpgradeCrossSecret:
                {
                    this.currentCopy = this.upgradeCrossSecretCopy;
                    break;
                }
                case ECopyType._ECopyMount:
                {
                    this.currentCopy = this.copyMount;
                    break;
                }
                case ECopyType._ECopyChoiceTemple:
                {
                    this.currentCopy = this.faneCopy;
                    break;
                }
                case ECopyType._ECopyCrossTower:
                {
                    this.currentCopy = this.crossTowerCopy;
                    break;
                }
                case ECopyType._ECopyPlough:
                {
                    this.currentCopy = this.ploughCopy;
                    break;
                }
                case ECopyType._ECopyDominion:
                {
                    this.currentCopy = this.dominionWar;
                    break;
                }
                case ECopyType._ECopy105Material:
                {
                    this.currentCopy = this.copy105Material;
                    break;
                }
                case ECopyType._ECopyChaosFight:
                {
                    this.currentCopy = this.heroBattle;
                    break;
                }
            }
            if (this.currentCopy == null && loc1.difficultyNum == EDifficultyOption._EDifficultySerious) 
            {
                this.currentCopy = this.kingCopy;
            }
            if (this.currentCopy) 
            {
                this.currentCopy.enterCopy(loc1);
            }
            if (this.needHideTaskTrace(loc1)) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.TaskTrackShowOrHide, false));
            }
            if (this.needHideMainUI(loc1)) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowGameMainUI, false));
            }
            if (this.needHideShortcuts(loc1)) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowOrHideShortcut, false));
            }
            if (this.needAutoKickOut(loc1)) 
            {
                AutoKickOutManager.instance.start();
            }
            if (this.needShowLeaveBtn(loc1)) 
            {
                flash.utils.setTimeout(this.addLeaveBtn, 1000);
            }
            else 
            {
                this.removeLeaveBtn();
            }
            if (cache.copy.isInCoinCopy()) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.CoinCopyEnterCopy, null);
            }
            else if (cache.copy.isInWeddingCopy()) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.MarryEnterWedding, null);
            }
            return;
        }

        public get copyInfo(): TCopy
        {
            return cache.copy.copyInfo;
        }

        /* internal  */onSceneUpdateHandler(arg1): void
        {
            Dispatcher.removeEventListener(EventName.Scene_Update, this.onSceneUpdateHandler);
            this.onEnterCopy(this._tempObj);
            return;
        }

        /* internal  */onLeaveCopy(arg1: TCopy): void
        {
            if (this.currentCopy) 
            {
                this.currentCopy.leaveCopy();
                this.currentCopy = null;
            }
            if (this.needHideTaskTrace(arg1)) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.TaskTrackShowOrHide, true));
            }
            if (this.needHideMainUI(arg1)) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowGameMainUI, true));
            }
            if (this.needHideShortcuts(arg1)) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowOrHideShortcut, true));
            }
            if (this.needAutoKickOut(arg1)) 
            {
                AutoKickOutManager.instance.stop();
            }
            this.removeLeaveBtn();
            if (arg1.copyType == ECopyType._ECopyCoin) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.CoinCopyLeaveCopy, null);
            }
            if (arg1.copyType != ECopyType._ECopyWedding) 
            {
                if (arg1.copyType == ECopyType._ECopyCrossBoss || arg1.copyType == ECopyType._ECopyUpgradeCrossBoss) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.CopyLeaveCrossBossCopy));
                }
            }
            else 
            {
                NetDispatcher.dispatchCmd(ServerCommand.MarryLeaveWedding, null);
            }
            if (!(arg1.singleMode == 1) || arg1.code == 131 || arg1.code == 140 || arg1.code == 141 || arg1.code == 154 || arg1.code == 156 || arg1.code == 185 || arg1.code == 187 || arg1.code == 191) 
            {
                this.checkAndShowCopyDrawReward(arg1);
            }
            MsgManager.removeTaskTarget();
            cache.copy.defendCopyExp = 0;
            return;
        }

        /* internal  */addLeaveBtn(arg1: Object /* flash.events.Event */=null): void
        {
            if (cache.copy.isInCopy && !this._copyLeaveBtn || GameMapUtil.curMapState.isCrossMainCity) 
            {
                this._copyLeaveBtn = ObjCreate.createGLoadedButton(ResFileConst.MagicTowerLeaveBtn, 320, 20, 50, 50, LayerManager.uiLayer);
                this._copyLeaveBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onLeaveCopyBtnClick);
                if (this._worningLeaveBtn) 
                {
                    this._worningLeaveBtn = false;
                    EffectManager.glowFilterReg(this._copyLeaveBtn, [FilterConst.uiBtnFilter], 1, 10, 0, 5);
                }
            }
            return;
        }

        /* internal  */removeLeaveBtn(arg1: Object /* flash.events.Event */=null): void
        {
            if (this._copyLeaveBtn && this._copyLeaveBtn.parent) 
            {
                EffectManager.glowFilterUnReg(this._copyLeaveBtn);
                if (this._leaveTips && this._leaveTips.parent) 
                {
                    this._leaveTips.parent.removeChild(this._leaveTips);
                    this._leaveTips.dispose();
                    this._leaveTips = null;
                }
                this._copyLeaveBtn.parent.removeChild(this._copyLeaveBtn);
                this._copyLeaveBtn.removeEventListener(flash.events.MouseEvent.CLICK, this.onLeaveCopyBtnClick);
                this._copyLeaveBtn = null;
            }
            return;
        }

        /* internal  */needHideMainUI(arg1: TCopy): Boolean
        {
            if (!arg1) 
            {
                return false;
            }
            if (arg1.code == CopyCodeRule.Copy90Tower) 
            {
                return true;
            }
            if (arg1.copyType == ECopyType._ECopyRobCityTwo || arg1.copyType == ECopyType._ECopyRobCityThree || arg1.copyType == ECopyType._ECopyCountryMoney || arg1.copyType == ECopyType._ECopyCrossBoss || arg1.copyType == ECopyType._ECopyUpgradeCrossBoss || arg1.copyType == ECopyType._ECopyCrossBossEntrance || arg1.copyType == ECopyType._ECopyUpgradeCrossBossEntrance || arg1.copyType == ECopyType._ECopyRobFlag || arg1.copyType == ECopyType._ECopyGuildElite || arg1.copyType == ECopyType._ECopy80Defense || arg1.copyType == ECopyType._ECopyFireMonsterIsland || arg1.copyType == ECopyType._ECopyFireIslandCenter || arg1.copyType == ECopyType._ECopyUpgradeCrossSecret || arg1.copyType == ECopyType._ECopyMount || arg1.copyType == ECopyType._ECopyChoiceTemple || arg1.copyType == ECopyType._ECopyCrossTower || arg1.copyType == ECopyType._ECopyPlough || arg1.copyType == ECopyType._ECopyDominion || arg1.copyType == ECopyType._ECopyChaosFight) 
            {
                return true;
            }
            return false;
        }

        /* internal  */needHideShortcuts(arg1: TCopy): Boolean
        {
            if (cache.copy.isInCrossDefenceCopy() || arg1.copyType == ECopyType._ECopyCountryMoney || arg1.copyType == ECopyType._ECopyRobFlag || arg1.copyType == ECopyType._ECopyChaosFight) 
            {
                return true;
            }
            return false;
        }

        /* internal  */needAutoKickOut(arg1: TCopy): Boolean
        {
            var loc1=arg1.copyType;
            switch (loc1) 
            {
                case ECopyType._ECopyRobFlag: case ECopyType._ECopyNewBattle: case ECopyType._ECopyDominion:
                {
                    return true;
                }
            }
            return false;
        }

        /* internal  */needShowLeaveBtn(arg1: TCopy): Boolean
        {
            if (cache.copy.isInCoinCopy() || arg1.copyType == ECopyType._ECopySeventy || arg1.copyType == ECopyType._ECopyTower || arg1.copyType == ECopyType._ECopy60Defense || arg1.copyType == ECopyType._ECopyGuildAltar || arg1.copyType == ECopyType._ECopyGuildStruggle || arg1.copyType == ECopyType._ECopyGuildDefense || arg1.copyType == ECopyType._ECopySkyCity || arg1.copyType == ECopyType._ECopyGuildPasture || arg1.copyType == ECopyType._ECopyCrossBeach || arg1.copyType == ECopyType._ECopyDrama || arg1.copyType == ECopyType._ECopyRace || arg1.copyType == ECopyType._ECopyEighty || arg1.copyType == ECopyType._ECopyCrossBoss || arg1.copyType == ECopyType._ECopyCrossBossEntrance || arg1.copyType == ECopyType._ECopyUpgradeCrossBoss || arg1.copyType == ECopyType._ECopyUpgradeCrossBossEntrance || arg1.copyType == ECopyType._ECopySeal || arg1.copyType == ECopyType._ECopyCrossStair || arg1.copyType == ECopyType._ECopyCrossDefense || arg1.copyType == ECopyType._ECopyVIPHook || arg1.copyType == ECopyType._ECopyCrossSecret || arg1.copyType == ECopyType._ECopyRobCityOne || arg1.copyType == ECopyType._ECopyRobCityTwo || arg1.copyType == ECopyType._ECopyRobCityThree || arg1.copyType == ECopyType._ECopyEatBeans || arg1.copyType == ECopyType._ECopyKingChampionship || arg1.copyType == ECopyType._ECopyCountryMoney || arg1.copyType == ECopyType._ECopyRobFlag || arg1.copyType == ECopyType._ECopyGuildElite || arg1.copyType == ECopyType._ECopyCrossGuildWar || arg1.copyType == ECopyType._ECopy80Defense || arg1.copyType == ECopyType._ECopyFireMonsterIsland || arg1.copyType == ECopyType._ECopyFireIslandCenter || arg1.copyType == ECopyType._ECopyUpgradeCrossSecret || arg1.copyType == ECopyType._ECopyMount || arg1.copyType == ECopyType._ECopyCrossSpiritWar || arg1.copyType == ECopyType._ECopyCrossSpiritWarWaitingRoom || arg1.copyType == ECopyType._ECopyChoiceTemple || arg1.copyType == ECopyType._ECopyLadder || arg1.copyType == ECopyType._ECopyCrossTower || arg1.copyType == ECopyType._ECopyPlough || arg1.copyType == ECopyType._ECopyDominion || arg1.copyType == ECopyType._ECopy105Material || arg1.copyType == ECopyType._ECopyChaosFight) 
            {
                return true;
            }
            if (cache.copy.isInKingCopy(arg1)) 
            {
                return true;
            }
            return false;
        }

        /* internal  */checkAndShowCopyDrawReward(arg1: TCopy): void
        {
            var loc1=null;
            if (!arg1) 
            {
                return;
            }
            if (!this.isShowDrawAndMark()) 
            {
                return;
            }
            if (cache.pack.copyBox.sbag) 
            {
                loc1 = this.getCopyBox(arg1);
                if (loc1) 
                {
                    if (!this._drawRewardButton) 
                    {
                        this._drawRewardButton = new CopyDrawRewardButton();
                    }
                    this._drawRewardButton.updateData(loc1, arg1);
                    this._drawRewardButton.show();
                }
            }
            else 
            {
                this._tempCopy = arg1;
                NetDispatcher.addCmdListener(ServerCommand.CopyBoxItemUpdate, this.onCopyBoxItemUpdate);
            }
            return;
        }

        /* internal  */needHideTaskTrace(arg1: TCopy): Boolean
        {
            if (!arg1) 
            {
                return false;
            }
            if (arg1.code == 106 || arg1.code == 116 || arg1.code == 123 || arg1.copyType == ECopyType._ECopyDefense || arg1.copyType == ECopyType._ECopy60Defense || arg1.copyType == ECopyType._ECopySeventy || arg1.copyType == ECopyType._ECopyGuildStruggle || arg1.copyType == ECopyType._ECopyGuildDefense || arg1.copyType == ECopyType._ECopyEighty || arg1.copyType == ECopyType._ECopySeal || arg1.copyType == ECopyType._ECopyCrossStair || arg1.copyType == ECopyType._ECopyRobCityOne || arg1.copyType == ECopyType._ECopyRobCityTwo || arg1.copyType == ECopyType._ECopyRobCityThree || arg1.copyType == ECopyType._ECopyCountryMoney || arg1.copyType == ECopyType._ECopyRobFlag || arg1.copyType == ECopyType._ECopyGuildElite || arg1.copyType == ECopyType._ECopy80Defense || arg1.copyType == ECopyType._ECopyFireMonsterIsland || arg1.copyType == ECopyType._ECopyFireIslandCenter || arg1.copyType == ECopyType._ECopyUpgradeCrossSecret || arg1.copyType == ECopyType._ECopyMount || arg1.copyType == ECopyType._ECopyChoiceTemple || arg1.copyType == ECopyType._ECopyPlough || arg1.copyType == ECopyType._ECopyDominion || arg1.copyType == ECopyType._ECopyChaosFight) 
            {
                return true;
            }
            return false;
        }

        /* internal  */onCopyBoxItemUpdate(arg1): void
        {
            this.checkAndShowCopyDrawReward(this._tempCopy);
            NetDispatcher.removeCmdListener(ServerCommand.CopyBoxItemUpdate, this.onCopyBoxItemUpdate);
            return;
        }

        /* internal  */isShowDrawAndMark(): Boolean
        {
            if (cache.role.roleInfo.level < 25 && cache.guide.fuBenGuide) 
            {
                return false;
            }
            return true;
        }

        /* internal  */getCopyBox(arg1: TCopy): ItemData
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=null;
            if (arg1) 
            {
                loc1 = cache.pack.copyBox._allItems;
                loc3 = 0;
                while (loc3 < loc1.length) 
                {
                    loc2 = loc1[loc3] is ItemData ? loc1[loc3] : null;
                    if (loc2 && this.isCurrentCopyBox(arg1.code, loc2)) 
                    {
                        if (this._drawRewardPanel && !this._drawRewardPanel.isHide) 
                        {
                            if (!(loc4 = this._drawRewardPanel.getDrawItem()) || !(loc4.uid == loc2.uid)) 
                            {
                                return loc2;
                            }
                        }
                        else 
                        {
                            return loc2;
                        }
                    }
                    ++loc3;
                }
            }
            return null;
        }

        /* internal  */isCurrentCopyBox(arg1: int, arg2: ItemData): Boolean
        {
            var loc2=0;
            var loc3=null;
            var loc4=null;
            var loc5=0;
            var loc6=0;
            var loc1=CopyConfig.instance.getDropBoxByCode(arg1);
            if (loc1) 
            {
                loc3 = loc1.careerDropCopyBox.split("#");
                loc4 = [];
                loc5 = 0;
                while (loc5 < loc3.length) 
                {
                    loc4 = (loc3[loc5] as string).split(",");
                    loc6 = 1;
                    while (loc6 < loc4.length) 
                    {
                        if ((loc2 = parseInt(loc4[loc6])) == arg2.itemCode) 
                        {
                            return true;
                        }
                        ++loc6;
                    }
                    ++loc5;
                }
            }
            return false;
        }

        /* internal  */onCopyProcessUpdate(arg1): void
        {
            ThingUtil.isEntitySort = true;
            if (this.currentCopy) 
            {
                this.currentCopy.updateCopyProcess();
            }
            return;
        }

        /* internal  */onCountDownInfoChange(arg1: SCopyMsgInfo): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            if (!this.copyInfo) 
            {
                return;
            }
            var loc4=arg1.type.value();
            switch (loc4) 
            {
                case ECopyInfoType._ECopyInfoTypeRing:
                {
                    if (this.currentCopy != this.defenceCopy) 
                    {
                        if (this.copyInfo.copyType != ECopyType._ECopyGuildDefense) 
                        {
                            if (this.copyInfo.copyType == ECopyType._ECopy80Defense) 
                            {
                                this.eightyDefenceCopy.updateRing(arg1);
                            }
                        }
                        else 
                        {
                            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildDefenseUpdateRing, arg1.num1));
                        }
                    }
                    else 
                    {
                        this.defenceCopy.updateRing(arg1);
                    }
                    break;
                }
                case ECopyInfoType._ECopyInfoTypeEnd:
                {
                    NetDispatcher.dispatchCmd(ServerCommand.CoinCopyEndTimeUpdate, arg1.num1);
                    break;
                }
                case ECopyInfoType._ECopyInfoTypeEvenCut:
                {
                    break;
                }
                case ECopyInfoType._ECopyInfoTypeExchange:
                {
                    loc1 = CopyConfig.instance.getInfoByCode(arg1.num3).name;
                    loc2 = new CopyRewardsAccountPanel();
                    loc2.title = loc1;
                    PopupManager.addPopUp(loc2, "", false);
                    loc2.startAccounts(arg1.num4, arg1.num5, arg1.num1, arg1.num2, arg1.num6);
                    break;
                }
                case ECopyInfoType._ECopyInfoTypeBossRefresh:
                {
                    if (cache.copy.isInPetlandCopy() && arg1.num2 == 0) 
                    {
                        Game.scene.shake(3);
                    }
                    else if (this.currentCopy == this.defenceCopy) 
                    {
                        this.defenceCopy.updateBossRefresh(arg1);
                    }
                    break;
                }
                case ECopyInfoType._ECopyInfoTypeEvenCutEx:
                {
                    NetDispatcher.dispatchCmd(ServerCommand.CoinCopyMsgInfoUpdate, arg1);
                    break;
                }
                case ECopyInfoType._ECopyInfoTypeEvenCutEnd:
                {
                    NetDispatcher.dispatchCmd(ServerCommand.CoinCopyMsgEnd, arg1);
                    break;
                }
                case ECopyInfoType._ECopyInfoTypeMark:
                {
                    if (this.isShowDrawAndMark()) 
                    {
                        if (arg1.num9 == 1 && !PulseSharedObject.isTodayNotTips(TodayNoTipsConst.CopyGradeAccountTodayNoTips)) 
                        {
                            this.showCopyGradeAccountPanel(arg1);
                        }
                        else 
                        {
                            loc3 = CopyConfig.instance.getInfoByCode(arg1.num8);
                            this.checkAndShowCopyDrawReward(loc3);
                        }
                    }
                    break;
                }
            }
            return;
        }

        /* internal  */showCopyGradeAccountPanel(arg1: SCopyMsgInfo): void
        {
            if (!this._copyGradeAcountPanel) 
            {
                this._copyGradeAcountPanel = new CopyGradeAccountView(cache.role.playerInfo.sex);
                this._copyGradeAcountPanel.addEventListener(ViewEvent.Hide, this.onCopyGradeAcountPanelHide);
            }
            this._copyGradeAcountPanel.show();
            this._copyGradeAcountPanel.updateInfo(arg1);
            this.stageResize();
            return;
        }

        /* internal  */onCopyGradeAcountPanelHide(arg1: ViewEvent): void
        {
            this.checkAndShowCopyDrawReward(this._copyGradeAcountPanel.copy);
            return;
        }

        /* internal  */onDefendCopyAddExp(arg1: int): void
        {
            if (!this.copyInfo) 
            {
                return;
            }
            if (this.currentCopy == this.defenceCopy) 
            {
                this.defenceCopy.updateRingBottleExp();
            }
            if (this.currentCopy == this.eightyDefenceCopy) 
            {
                this.eightyDefenceCopy.updateExp(arg1);
            }
            return;
        }

        /* internal  */onCopyChooseFromNpc(arg1: DataEvent): void
        {
            var loc3=null;
            var loc1=arg1.data as int;
            var loc2=CopyConfig.instance.getInfoByCode(loc1);
            if (!loc2) 
            {
                MsgManager.showRollTipsMsg(Language.getString(60023));
                return;
            }
            if (!this.checkCanEnterCopy(loc2)) 
            {
                return;
            }
            if (loc2 && loc2.singleMode == 1) 
            {
                this.doEnterCopy(loc2.code);
            }
            else if (loc3 = cache.dialog.npcInfo) 
            {
                if (CopyUtil.isCrossCopy(loc2)) 
                {
                    GameProxy.copy.enterCrossCopyWaitingRoom_async(loc1, ECopyWaitingOperate._ECopyWaitingEnter, loc3.tnpc.npcId);
                }
                else 
                {
                    GameProxy.copy.enterCopyWaitingRoom_async(loc1, ECopyWaitingOperate._ECopyWaitingEnter, loc3.tnpc.npcId);
                }
                this.copyGroupController.showModuleByCopy(loc2, loc3);
            }
            return;
        }

        /* internal  */checkCanEnterCopy(arg1: TCopy): Boolean
        {
            var copy: TCopy;
            var info: TaskActInfo;

            var loc1;
            info = null;
            copy = arg1;
            if (cache.role.roleInfo.level < copy.enterMinLevel) 
            {
                MsgManager.showRollTipsMsg(Language.getString(60024));
                return false;
            }
            if (cache.task.getTrasnportTask()) 
            {
                Alert.buttonWidth = 75;
                Alert.okLabel = Language.getString(60025);
                Alert.show(Language.getString(60026), Language.getString(69900), Alert.OK | Alert.CANCEL, null, (arg1: int): void
                {
                    if (arg1 == Alert.OK) 
                    {
                        AIManager.onAutoPathAIControl(cache.task.getTrasnportTask().getTargetByIndex(0));
                    }
                    return;
                })
                return false;
            }
            if (!(copy.difficultyNum == EDifficultyOption._EDifficultyHard) && cache.copy.getCopyNumInfoByCode(copy.code) && cache.copy.getCopyNumInfoByCode(copy.code).todayEnterNum >= CopyUtil.getCopyNumByDay(copy) && !Global.isDebugModle) 
            {
                MsgManager.showRollTipsMsg(Language.getString(60027));
                info = cache.task.getNearlyActiveDaily();
                if (info) 
                {
                    Alert.buttonWidth = 75;
                    Alert.okLabel = Language.getString(60028);
                    Alert.show(Language.getString(60029) + HTMLUtil.addColor(info.dailyInfo.name, "#FF00FF") + "。", Language.getString(69900), Alert.OK | Alert.CANCEL, null, (arg1: int): void
                    {
                        if (arg1 == Alert.OK) 
                        {
                            Dispatcher.dispatchEvent(new DataEvent(EventName.DailyActiveGoTo, info.dailyInfo));
                        }
                        return;
                    })
                }
                return false;
            }
            return true;
        }

        /* internal  */onCopyGroupEnterCopy(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            this.doEnterCopy(loc1);
            return;
        }

        /* internal  */onEnterCopyPracticeMode(arg1: DataEvent): void
        {
            var loc3=null;
            var loc1=arg1.data as int;
            var loc2=CopyConfig.instance.getInfoByCode(loc1);
            if (loc2) 
            {
                Alert.extendObj = loc1;
                loc3 = Language.getStringByParam(60462, GameConst.CrossDefensePracticeNum, HTMLUtil.addColor(loc2.name, "#00a2ff"), GameConst.CrossDefensePracticeCost);
                Alert.show(loc3, null, Alert.OK | Alert.CANCEL, null, this.onEnterCopyPracticeAlertHandler);
            }
            return;
        }

        /* internal  */onEnterCopyPracticeAlertHandler(arg1: int, arg2: int): void
        {
            if (arg1 == Alert.OK) 
            {
                GameProxy.copy.enterCrossCopy(arg2, true);
            }
            return;
        }

        /* internal  */onGetAllCopyOffLineExp(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            GameProxy.copy.drawCopyExp(-1, -1, loc1, 0);
            return;
        }

        /* internal  */onSetCopyExtraTime(arg1: DataEvent): void
        {
            var loc1=arg1.data;
            cache.copy.setCopyExtraTime(loc1.copyId, loc1.value);
            return;
        }

        /* internal  */drawCopyRewards(arg1: ItemData): void
        {
            if (!this._drawRewardPanel) 
            {
                this._drawRewardPanel = new CopyDrawRewardPanel();
                this._drawRewardPanel.addEventListener(CopyDrawRewardComp.DrawComplete, this.onDrawComplete);
            }
            if (this._drawRewardPanel.isDrawing()) 
            {
                MsgManager.showRollTipsMsg(Language.getString(60032));
            }
            else 
            {
                this._drawRewardPanel.setDrawItem(arg1);
                this._drawRewardPanel.show();
                if (this._drawRewardButton) 
                {
                    this._drawRewardButton.hide();
                }
            }
            return;
        }

        /* internal  */onDrawComplete(arg1: DataEvent): void
        {
            var loc1=null;
            var loc2=null;
            loc1 = arg1.data as ItemData;
            if (loc1) 
            {
                loc2 = CopyConfig.instance.getInfoByCode(loc1.itemInfo.item.effectEx);
            }
            if (!loc2 || cache.copy.isInCopy && cache.copy.copyInfo && cache.copy.copyInfo.code == loc2.code) 
            {
                return;
            }
            loc1 = this.getCopyBox(loc2);
            if (loc1) 
            {
                this.drawCopyRewards(loc1);
            }
            return;
        }

        /* internal  */onLeaveCopyBtnClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (GameMapUtil.curMapState.isCrossMainCity) 
            {
                GameProxy.sceneProxy.pass(EPassType.convert(EPassType._EPassTypeCrossUnique), 0, 0);
                return;
            }
            this.onQuitCopy();
            return;
        }

        /* internal  */doEnterCopy(arg1: int): void
        {
            var loc2=0;
            var loc3=null;
            var loc1=CopyConfig.instance.getInfoByCode(arg1);
            if (loc1.singleMode != 1) 
            {
                if (!CopyUtil.isCrossCopy(loc1) && !cache.group.isInGroup) 
                {
                    Alert.extendObj = loc1;
                    Alert.show("    " + Language.getString(60038), Language.getString(69900), Alert.OK | Alert.CANCEL, null, this.onCreateGroupAlertHandler);
                }
                else if (CopyUtil.isCrossCopy(loc1) && !cache.crossGroup.isInGroup) 
                {
                    Alert.extendObj = loc1;
                    Alert.show("    " + Language.getString(60903), Language.getString(69900), Alert.OK | Alert.CANCEL, null, this.onCreateGroupAlertHandler);
                }
                else if (!CopyUtil.isCrossCopy(loc1) && cache.group.isCaptain || CopyUtil.isCrossCopy(loc1) && cache.crossGroup.isCaptain) 
                {
                    Alert.extendObj = loc1;
                    Alert.show("    " + Language.getStringByParam(60039, loc1.name), Language.getString(69900), Alert.OK | Alert.CANCEL, null, this.onEnterCopyAlertHandler);
                }
                else 
                {
                    this.enterCopyEx(loc1);
                }
            }
            else if (CopyUtil.isCrossCopy(loc1)) 
            {
                if (loc1.costCoin > 0) 
                {
                    loc2 = loc1.costCoin;
                    loc3 = GameDefConfig.instance.getEPrictUnitName(EPrictUnit._EPriceUnitCoin);
                }
                else if (loc1.costGold > 0) 
                {
                    loc2 = loc1.costGold;
                    loc3 = GameDefConfig.instance.getEPrictUnitName(EPrictUnit._EPriceUnitGold);
                }
                if (loc2 > 0) 
                {
                    Alert.extendObj = loc1;
                    Alert.show(Language.getStringByParam(60901, loc2, loc3), Language.getString(69900), Alert.OK | Alert.CANCEL, null, this.onEnterCopyAlertHandler);
                }
                else 
                {
                    this.enterCopyEx(loc1);
                }
            }
            else 
            {
                this.enterCopyEx(loc1);
            }
            return;
        }

        /* internal  */onCreateGroupAlertHandler(arg1: int, arg2: TCopy): void
        {
            if (arg1 == Alert.OK) 
            {
                if (CopyUtil.isCrossCopy(arg2)) 
                {
                    GameProxy.crossGroupProxy.createGroup(cache.crossGroup.memberInvite, AutoFight.localAutoFight.acceptTeam);
                }
                else 
                {
                    GameProxy.groupProxy.createGroup(cache.group.memberInvite, AutoFight.localAutoFight.acceptTeam);
                }
            }
            return;
        }

        /* internal  */onEnterCopyAlertHandler(arg1: int, arg2: TCopy): void
        {
            if (arg1 == Alert.OK) 
            {
                this.enterCopyEx(arg2);
            }
            return;
        }

        /* internal  */enterCopyEx(arg1: TCopy): void
        {
            var loc2=false;
            var loc4=null;
            var loc5=0;
            var loc1=0;
            var loc3;
            if ((loc3 = cache.copy.getCopyExtraTime(arg1.code)) > 0) 
            {
                loc1 = loc1 + arg1.extraDropCost * loc3;
            }
            if (arg1.copyType != ECopyType._ECopyTower) 
            {
                if (CopyUtil.isCrossCopy(arg1)) 
                {
                    GameProxy.copy.enterCrossCopy(arg1.code);
                }
                else 
                {
                    loc2 = BuyAlert.checkMoney(EPrictUnit._EPriceUnitGold, loc1);
                    if (!loc2) 
                    {
                        return;
                    }
                    GameProxy.copy.enterCopyEx_async(arg1.code, loc3);
                }
            }
            else 
            {
                if (!(CopyUtil.toWhichFloor == 0) && cache.pack.towerCopy.itemLength > 0) 
                {
                    MsgManager.showRollTipsMsg(Language.getString(60416));
                    return;
                }
                if (CopyUtil.toWhichFloor != 0) 
                {
                    loc4 = MagicTowerConfig.instance.getJumpInfoByJumpFloor(arg1.code, CopyUtil.toWhichFloor);
                    loc1 = loc1 + (loc4 ? loc4.jumpCost : 0);
                }
                loc2 = BuyAlert.checkMoney(EPrictUnit._EPriceUnitGold, loc1);
                if (!loc2) 
                {
                    return;
                }
                loc5 = loc4 ? loc4.realFloor : 1;
                GameProxy.copy.enterMagicTower(arg1.code, loc5, loc3);
            }
            return;
        }

        /* internal  */reset(): void
        {
            this._resetFlag = flash.utils.getTimer();
            GameProxy.copy.resetCopy(this.copyInfo.code, this.onResetSuccess);
            return;
        }

        /* internal  */doLeaveWithoutComfirm(arg1: DataEvent): void
        {
            GameProxy.copy.leftGroup_async();
            return;
        }

        /* internal  */doKickOut(arg1: DataEvent): void
        {
            var e: DataEvent;
            var id: SEntityId;
            var alertResult: Function;

            var loc1;
            id = null;
            e = arg1;
            id = e.data as SEntityId;
            if (cache.copy.groupInfo.fighting) 
            {
                alertResult = (arg1: int): void
                {
                    if (arg1 == Alert.YES) 
                    {
                        GameProxy.copy.kickOutGroup_async(id);
                    }
                    return;
                }
                Alert.show(Language.getString(60040), null, Alert.YES | Alert.NO, null, alertResult);
            }
            else 
            {
                GameProxy.copy.kickOutGroup_async(id);
            }
            return;
        }

        protected initControllers(): void
        {
            this.copyGroupController = new CopyGroupController();
            this.fairyLandCopy = new CopyFairyController();
            this.defenceCopy = new DefenceCopyController();
            this.sixtyCopy = new SixtyCopyController();
            this.guildCopy = new GuildCopyController();
            this.guildCopyDefense = new GuildCopyDefenseController();
            this.guildEliteCopy = new GuildEliteCopyController();
            this.towerCopy = new TowerCopyController();
            this.seventyCopy = new SeventyCopyController();
            this.eightyCopy = new EightyCopyController();
            this.levelSealCopy = new LevelSealController();
            this.crossStairCopy = new CrossStairController();
            this.crossDefenceCopy = new CrossDefenceCopyController();
            this.crossAryadevaSecretCopy = new CrossAryadevaSecretCopyController();
            this.guildRobCityCopy = new GuildRobCityCopyController();
            this.kingCopy = new KingCopyController();
            this.eatBeans = new EatBeansController();
            this.kingChampionShip = new KingChampionShipController();
            this.crossSea = new CrossSeaController();
            this.countryMoneyCopy = new CountryMoneyCopyController();
            this.robFlag = new RobFlagController();
            this.eightyDefenceCopy = new EightyDefenceCopyController();
            this.lv88 = new Lv88CopyController();
            this.upgradeCrossSecretCopy = new UpgradeCrossSecretCopyController();
            this.copyMount = new CopyMountController();
            this.faneCopy = new FaneCopyController();
            this.crossTowerCopy = new CrossTowerCopyController();
            this.ploughCopy = new PloughCopyController();
            this.dominionWar = new DominionWarCopyController();
            this.copy105Material = new MaterialCopyController();
            this.heroBattle = new HeroBattleController();
            return;
        }

        protected /* override */ initServer(): void
        {
            Dispatcher.addEventListener(EventName.CopyQuitCopy, this.onQuitCopy);
            Dispatcher.addEventListener(EventName.CopyKickOut, this.doKickOut);
            Dispatcher.addEventListener(EventName.CopyLeaveWithoutComfirm, this.doLeaveWithoutComfirm);
            Dispatcher.addEventListener(EventName.VIPHookQuit, this.onQuitVipHookMap);
            Dispatcher.addEventListener(EventName.CopyCopyChooseFromNpc, this.onCopyChooseFromNpc);
            Dispatcher.addEventListener(EventName.CopyGroupDoEnterCopy, this.onCopyGroupEnterCopy);
            Dispatcher.addEventListener(EventName.CopyEnterPracticeCopy, this.onEnterCopyPracticeMode);
            Dispatcher.addEventListener(EventName.CopyCopyDrawRewards, this.onCopyDrawRewards);
            Dispatcher.addEventListener(EventName.CopyTotalExpGetReq, this.onGetAllCopyOffLineExp);
            Dispatcher.addEventListener(EventName.CopySetCopyExtraTime, this.onSetCopyExtraTime);
            Dispatcher.addEventListener(EventName.CopyAddLeaveButton, this.addLeaveBtn);
            Dispatcher.addEventListener(EventName.CopyRemoveLeaveButton, this.removeLeaveBtn);
            NetDispatcher.addCmdListener(ServerCommand.Copy_CopyNumInfoChange, this.onCopyNumInfoChange);
            NetDispatcher.addCmdListener(ServerCommand.Copy_RefreshCountDownInfo, this.onCountDownInfoChange);
            NetDispatcher.addCmdListener(ServerCommand.Copy_DefendCopyAddExp, this.onDefendCopyAddExp);
            NetDispatcher.addCmdListener(ServerCommand.Copy_EnterCopy, this.onEnterCopy);
            NetDispatcher.addCmdListener(ServerCommand.Copy_LeaveCopy, this.onLeaveCopy);
            NetDispatcher.addCmdListener(ServerCommand.Copy_ProcessUpdate, this.onCopyProcessUpdate);
            Dispatcher.addEventListener(EventName.Guide_ClickCopyExit, this.onGuideCopyExitClick);
            return;
        }

        /* internal  */onGuideCopyExitClick(arg1: DataEvent): void
        {
            var loc1=null;
            if (this._copyLeaveBtn && this._copyLeaveBtn.parent) 
            {
                EffectManager.glowFilterReg(this._copyLeaveBtn, [FilterConst.guideTipsFilter]);
                loc1 = Language.getString(60041);
                if (cache.copy.isInSeventyCopyWhichFloor() == 1) 
                {
                    loc1 = Language.getString(60368);
                }
                if (!this._leaveTips) 
                {
                    this._leaveTips = new GuideTips();
                }
                this._leaveTips.updateTxt(loc1);
                this._leaveTips.updateDir(GuideTipsManager.Dir_TL);
                this._leaveTips.x = this._copyLeaveBtn.x + this._copyLeaveBtn.width;
                this._leaveTips.y = this._copyLeaveBtn.y + this._copyLeaveBtn.height;
                this._copyLeaveBtn.parent.addChild(this._leaveTips);
            }
            return;
        }

        /* internal  */onCopyNumInfoChange(arg1: Object=null): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            if (cache.role.roleInfo && cache.role.roleInfo.level >= 36) 
            {
                loc1 = cache.daily.getCopyGradeNumInfos();
                var loc5=0;
                var loc6=loc1;
                for(loc3 of loc6) 
                {
                    loc2 = CopyConfig.instance.getCopyGradeInfo(loc3.todayBestCredit);
                    if (!(loc3.todayBestCredit > 0 && loc2 && loc2.level > loc3.getRewardLevel)) 
                    {
                        continue;
                    }
                    loc4 = loc3.copyCode + "_" + loc3.todayBestCredit;
                    if (this._copyMarkDic[loc4]) 
                    {
                        continue;
                    }
                    this._copyMarkDic[loc4] = true;
                    Dispatcher.dispatchEvent(new DataEvent(EventName.HighlightGameUI, {"type":"Navbar", "name": Daily, "isGlow": true}));
                    cache.guide.guideCopyMarkReward = loc3.copyCode;
                }
            }
            return;
        }

        /* internal  */onCleanCopyEnteredNum(arg1: Object=null): void
        {
            cache.copy.cleanCopyEnteredNum();
            NetDispatcher.dispatchCmd(ServerCommand.Copy_CopyNumInfoChange, null);
            return;
        }

        /* internal  */onQuitCopy(arg1: DataEvent=null): void
        {
            var loc1=0;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=null;
            if (_view) 
            {
                _view.hide();
            }
            if (!this.copyInfo) 
            {
                return;
            }
            if (GameMapUtil.curMapState.isCrossGuildWar && !GameMapUtil.curMapState.isCrossGuildWarWaittingRoom) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.CrossGuildWarLeaveReq));
                return;
            }
            if (this.copyInfo.copyType == ECopyType._ECopyRobFlag) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.RobFlagLeaveCopyReq, false));
                return;
            }
            if (this.copyInfo.code == 104) 
            {
                this.onLeaveComfirm(Alert.YES);
                return;
            }
            if (this.copyInfo.copyType == ECopyType._ECopyGuildAltar) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.GuildAnimalCopyLeave));
                return;
            }
            if (this.copyInfo.copyType == ECopyType._ECopyGuildPasture) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.GuildPastureCopyLeave));
                return;
            }
            if (this.crossAryadevaSecretCopy.CrossSecretRewardItemsNum > 0 && cache.copy.copyInfo.code == CopyType.CROSS_ARYADEVA_SECRET_COPY) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.LeaveCrossAryadevaSecretCopyAndShowRewardView, {"showReturnBtn": true}));
                return;
            }
            if (this.kingCopy.rewardItemsNum > 0 && cache.copy.copyInfo.difficultyNum == EDifficultyOption._EDifficultySerious && (arg1 == null || arg1 && !(cache.copy.copyInfo.copyId == 199))) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.LeaveKingCopyAndShowRewardView));
                return;
            }
            if (cache.copy.isInEatBeansCopy() && cache.eatBeans.doingStatus == EatBeansDoingStatus.End) 
            {
                this.leave();
                return;
            }
            if (GameMapUtil.curMapState.isCrossSpiritWarCopyCode) 
            {
                loc3 = cache.role.entityInfo.fightModel != EEntityFightMode._EEntityFightModeObseve ? Language.getString(28618) : Language.getString(90322);
                Dispatcher.dispatchEvent(new DataEvent(EventName.AttachedSoulBattlefielLeave, {"needShowAlert": true, "str": loc3}));
                return;
            }
            if (GameMapUtil.curMapState.isLadderBattlefield) 
            {
                loc4 = cache.role.entityInfo.fightModel != EEntityFightMode._EEntityFightModeObseve ? Language.getString(28618) : Language.getString(90322);
                Dispatcher.dispatchEvent(new DataEvent(EventName.LadderBattlefieldLeave, {"needShowAlert": true, "str": loc4}));
                return;
            }
            if (cache.copy.isInLevelSealCopy() && cache.copy.levelSeal.hasRewards) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.CopyLeaveSealCopy));
                return;
            }
            if (cache.copy.isInSeventyCopyWhichFloor() == 2) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.Copy_LeaveSeventyCopySecondFloor));
                return;
            }
            if (this.upgradeCrossSecretCopy.crossSecretRewardItemsNum > 0 && cache.copy.copyInfo.code == CopyType.UPGRARE_CROSS_SECRET_COPY) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.UpgradeCrossSecretLeaveAndShowRewardView, {"showReturnBtn": true}));
                return;
            }
            if (this.copyInfo.copyType == ECopyType._ECopyDominion || GameMapUtil.curMapState.isDominionCopy) 
            {
                this.leave();
                return;
            }
            if (this.copyInfo.copyType == ECopyType._ECopyChaosFight) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.HeroBattleLeaveCopy));
                return;
            }
            if (this.isShowCopyReset(this.copyInfo)) 
            {
                if (flash.utils.getTimer() - this._resetFlag < 2000) 
                {
                    return;
                }
                if (cache.role.roleInfo.level < 36 || cache.copy.getHasEnterNumById(this.copyInfo.code) >= CopyUtil.getCopyNumByDay(this.copyInfo)) 
                {
                    if (this.copyInfo.code != 123) 
                    {
                        loc2 = Language.getStringByParam(60016, this.copyInfo.name);
                        loc1 = Alert.YES;
                    }
                    else 
                    {
                        loc2 = Language.getStringByParam(60015, this.copyInfo.name);
                        loc1 = Alert.YES;
                    }
                }
                else 
                {
                    loc2 = Language.getStringByParam(60017, this.copyInfo.name);
                    loc1 = Alert.YES | Alert.NO;
                }
                Alert.yesLabel = Language.getString(60018);
                Alert.noLabel = Language.getString(60019);
                Alert.showCloseBtn = true;
                Alert.buttonWidth = 75;
                loc5 = Alert.show(loc2, null, loc1, null, this.onLeaveComfirm) as GAlertWin;
                if (cache.role.roleInfo.level >= 36) 
                {
                    if (loc6 = loc5.getButtonByFlag(Alert.NO)) 
                    {
                        EffectManager.glowFilterReg(loc6, [new Object /* flash.filters.GlowFilter */(16776960)], 0.6, 10, 5, 50);
                    }
                }
            }
            else 
            {
                if (cache.role.entityInfo.fightModel != EEntityFightMode._EEntityFightModeObseve) 
                {
                    if (GameMapUtil.curMapState.isCrossGuildWarWaittingRoom) 
                    {
                        loc2 = Language.getStringByParam(80584, this.copyInfo.name);
                    }
                    else if (this.copyInfo.copyType != ECopyType._ECopyCrossStair) 
                    {
                        if (cache.copy.isInEatBeansCopy() && cache.eatBeans.doingStatus < EatBeansDoingStatus.End) 
                        {
                            loc2 = Language.getString(80364);
                        }
                        else if (this.copyInfo.copyType != ECopyType._ECopyGuildElite) 
                        {
                            loc2 = Language.getStringByParam(69910, this.copyInfo.name);
                        }
                        else 
                        {
                            loc2 = Language.getStringByParam(69910, SceneConfig.instance.getMapName(MapFileUtil.mapID));
                        }
                    }
                    else 
                    {
                        loc2 = Language.getString(60835);
                    }
                }
                else 
                {
                    loc2 = Language.getString(90322);
                }
                if (!this._isShowAlert) 
                {
                    this._isShowAlert = true;
                    Alert.show(loc2, null, Alert.YES | Alert.NO, null, this.onLeaveComfirm);
                }
            }
            return;
        }

        public onLeaveComfirm(arg1: int): void
        {
            this._isShowAlert = false;
            if (this.isShowCopyReset(this.copyInfo)) 
            {
                if (arg1 != Alert.NO) 
                {
                    if (arg1 == Alert.YES) 
                    {
                        this.leave();
                    }
                }
                else 
                {
                    this.reset();
                }
            }
            else if (arg1 == Alert.YES) 
            {
                this.leave();
            }
            return;
        }

        /* internal  */leave(): void
        {
            if (cache.copy.isInEatBeansCopy()) 
            {
                GameProxy.copy.leftEatBeans();
                return;
            }
            if (cache.copy.isInCopyType(ECopyType._ECopyGuildElite) && !(MapFileUtil.mapID == cache.copy.copyInfo.intoMapId)) 
            {
                GameProxy.copy.enterGuildElite(this.copyInfo.code, this.copyInfo.intoMapId);
                return;
            }
            GameProxy.copy.leftGroup_async();
            return;
        }

        public stageResize(): void
        {
            if (this.currentCopy) 
            {
                this.currentCopy.stageResize();
            }
            this.copyGroupController.stageResize();
            if (this._copyLeaveBtn) 
            {
                this._copyLeaveBtn.x = 320;
                this._copyLeaveBtn.y = 20;
            }
            if (this._drawRewardButton && this._drawRewardButton.parent) 
            {
                this._drawRewardButton.x = Global.stage.stageWidth / 2 + 3;
            }
            if (this._drawRewardPanel) 
            {
                this._drawRewardPanel.stageResize();
            }
            if (this._copyGradeAcountPanel) 
            {
                this._copyGradeAcountPanel.x = Global.stage.stageWidth / 2 - 320;
                this._copyGradeAcountPanel.y = Global.stage.stageHeight / 2 - 225;
            }
            if (this.upgradeCrossSecretCopy) 
            {
                this.upgradeCrossSecretCopy.stageResize();
            }
            return;
        }

        /* internal  */onCopyDrawRewards(arg1: DataEvent): void
        {
            this.drawCopyRewards(arg1.data as ItemData);
            return;
        }

        /* internal  */onResetSuccess(arg1): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyCopyReset));
            return;
        }

        /* internal  */isShowCopyReset(arg1: TCopy): Boolean
        {
            return arg1 && arg1.singleMode == 1 && (arg1.copyType == ECopyType._ECopyNormal || arg1.copyType == ECopyType._ECopyDefense);
        }

        /* internal  */onQuitVipHookMap(arg1: DataEvent): void
        {
            Alert.show(HTMLUtil.addColor(Language.getString(60021), GlobalStyle.color1), Language.getString(69900), Alert.YES | Alert.NO, null, this.onQuitVipHookAlertClose);
            return;
        }

        /* internal  */onQuitVipHookAlertClose(arg1: int): void
        {
            if (arg1 == Alert.YES) 
            {
                GameProxy.copy.leftGroup_async();
            }
            return;
        }

        public /* var */currentCopy: ICopyController;

        private /* var */_copyGradeAcountPanel: CopyGradeAccountView;

        private /* var */_copyLeaveBtn: GLoadedButton;

        private /* var */_drawRewardPanel: CopyDrawRewardPanel;

        private /* var */_drawRewardButton: CopyDrawRewardButton;

        private /* var */_isShowAlert: Boolean=false;

        public /* var */copyGroupController: CopyGroupController;

        public /* var */fairyLandCopy: CopyFairyController;

        public /* var */defenceCopy: DefenceCopyController;

        public /* var */sixtyCopy: SixtyCopyController;

        public /* var */guildCopyDefense: GuildCopyDefenseController;

        public /* var */guildEliteCopy: GuildEliteCopyController;

        public /* var */towerCopy: TowerCopyController;

        public /* var */seventyCopy: SeventyCopyController;

        public /* var */eightyCopy: EightyCopyController;

        public /* var */levelSealCopy: LevelSealController;

        public /* var */crossStairCopy: CrossStairController;

        public /* var */crossDefenceCopy: CrossDefenceCopyController;

        public /* var */crossAryadevaSecretCopy: CrossAryadevaSecretCopyController;

        public /* var */guildRobCityCopy: GuildRobCityCopyController;

        public /* var */kingCopy: KingCopyController;

        public /* var */eatBeans: EatBeansController;

        public /* var */kingChampionShip: KingChampionShipController;

        public /* var */crossSea: CrossSeaController;

        public /* var */countryMoneyCopy: CountryMoneyCopyController;

        public /* var */robFlag: RobFlagController;

        public /* var */eightyDefenceCopy: EightyDefenceCopyController;

        public /* var */lv88: Lv88CopyController;

        public /* var */upgradeCrossSecretCopy: UpgradeCrossSecretCopyController;

        public /* var */copyMount: CopyMountController;

        public /* var */faneCopy: FaneCopyController;

        public /* var */crossTowerCopy: CrossTowerCopyController;

        public /* var */ploughCopy: PloughCopyController;

        public /* var */copy105Material: MaterialCopyController;

        public /* var */heroBattle: HeroBattleController;

        private /* var */_copyMarkDic: Map<any, any> /* flash.utils.Dictionary */;

        private /* var */_resetFlag: int;

        private /* var */_tempObj: Object;

        private /* var */_worningLeaveBtn: Boolean=true;

        private /* var */_tempCopy: TCopy;

        private /* var */_leaveTips: GuideTips;

        public /* var */guildCopy: GuildCopyController;

        public /* var */dominionWar: DominionWarCopyController;
    }
